package com.newdriver.prac;
//
//
public class Prac4{
    public static void main(String[] args) {
        Fu f=new Fu();
        f.fangFa1();

        Zi z=new Zi();
        z.fangFa1();
        z.fangFa2();

        Sun s=new Sun();
        s.fangFa3();
        s.fangFa2();
        s.fangFa1();
    }
}


class Fu {
    //默认
    void fangFa1(){
        System.out.println("方法1");
    }
}
    //final class Zi extends Fu 不能被继承
    class Zi extends Fu{
    void fangFa2(){
        System.out.println("方法2");
    }
}
class Sun extends Zi{
    void fangFa3(){
        System.out.println("方法3");
    }
}


